#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# @Time    : 2022/8/1 21:53
# @Author  : mojin
# @Email   : 397135766@qq.com
# @File    : message_bs.py
# @Software: PyCharm
#-------------------------------------------------------------------------------
from time import sleep
import allure,json
from base.base_page import BasePage
from business.call.call_page import Call_Page
from business.message.message_page import Message_page
from common.logger import Logger

class Message_bs():
    def __init__(self,drivers):

        self.d0 = BasePage(drivers[0])

    def send_message(self,test_data):
        name_wx = test_data['name_wx']#'mojin20220113'

        self.d0.click_elements(*Call_Page.SearchButton,doc='点击首页消息界面搜索按钮')
        self.d0.send_keys(*Call_Page.SearchBox,name_wx,doc='输入微信名称',inputType='send_keys',screenshot=2)

        Call_Page.SelectPersonnel[1]="微信号: %s"%name_wx #修改微信名，使用传进来的微信名
        Logger.info(Call_Page.SelectPersonnel)
        self.d0.click_elements(*Call_Page.SelectPersonnel, doc='点击选择搜索的人员')

        self.d0.send_keys(*Message_page.MessageInputBox, test_data['set_text'], doc='输入微信消息', inputType='set_text',screenshot=2)
        self.d0.click_elements(*Message_page.SendOut, doc='点击发送',screenshot=2)
        sleep(3)



